package com.mkyong.hello.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/helloWorld1")
public class HelloWorldController {
	private HelloWorldDAO dao;
	
//	@Autowired
//	public void init(HelloWorldDAO dao, Object obj1, Object obj2){
//		this.dao = dao;
//	}
//	
//	@Autowired
//	public void setHelloWorldDAO(HelloWorldDAO dao){
//		this.dao = dao;
//	}	
	
	@Autowired
	public HelloWorldController(HelloWorldDAO dao){
		this.dao = dao;
	}
	
	
	@RequestMapping("/helloWorld1")
	public ModelAndView helloWorld1() {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("helloWorld");
		mav.addObject("message", "Hello World 1!");
		return mav;
	}
	
	@RequestMapping("/helloWorld2")
	public ModelAndView helloWorld2() {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("helloWorld");
		mav.addObject("message", "Hello World 2!");
		return mav;
	}
	
	@RequestMapping("/helloWorld3")
	public ModelAndView helloWorld3() {
		ModelAndView mav = new ModelAndView();
		mav.setViewName("helloWorld");
		mav.addObject("message", "Hello World 3!");
		return mav;
	}
}
